@extends('admin.app')
@section('content')
    <link rel="stylesheet" href="/css/icon/iconfont-0130.css">
    <link rel="stylesheet" href="/addons/icheck-1.x/skins/square/green.css">
    {{--<link rel="stylesheet" href="/css/admin/performance-setting.css">--}}
    <script src="/addons/icheck-1.x/icheck.min.js"></script>

    <link rel="stylesheet" href="/css/admin/mobileSelect.css">
    <link rel="stylesheet" href="/css/admin/whole-performance.css?v=2018121201">
    <style>
        .mobileSelect .grayLayer {
            background: rgba(0, 0, 0, 0.5) !important;
        }
    </style>
    <div class="mian-container">
        <div class="whole-performance">
            <div class="weui-cells choose-time">
                <a class="weui-cell weui-cell_access" href="javascript:;">
                    <div class="weui-cell__hd">
                        <img src="/img/title.png" style="width:22px;">
                    </div>
                    <div class="weui-cell__bd">
                        <p>管理标签</p>
                    </div>
                    <div class="weui-cell__ft">
                    </div>
                </a>
                <div class="weui-cell">
                    <div class="weui-cell__hd">
                        <p><i class="icon iconfont icon-kaoqin"></i>选择时间</p>
                    </div>
                    <div class="weui-cell__bd">
                        <div id="trigger3">{{$year}}/{{$month}}</div>
                    </div>
                </div>
            </div>


            @foreach($tongxunlu as $t)


                <div class="weui-cells">
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <img class="floor-img" src="/images/admin/group-floora.png">
                        </div>
                        <div class="weui-cell__bd">
                            <p class="whole-name">{{$t['group_name']}}</p>
                        </div>
                    </div>
                    @foreach($t['member'] as $m)
                        <div class="parent-div">
                            <img class="sec-img" src="{{userlogo($m->id)}}">
                            <span class="sec-name">{{$m['qw_name']}}</span>
                            @foreach($m['role'] as $mr)
                                <span class="circle-span span-exam">{{$roleArray[$mr]}}</span>
                            @endforeach


                            @foreach($m->achievement as $achievement)
                                <div class="childern-div">
                                    <div>
                                        <p class="project-p">{{$achievement->name}}</p>
                                    </div>
                                    <div class="standard-p">
                                        <p class="gray-p">标准值</p>
                                        <p class="stand-p">{{$achievement->standard}}</p>
                                    </div>
                                    <div class="standard-p">
                                        <p class="gray-p">完成值</p>
                                        <p class="stand-p">{{$achievement->score}}</p>
                                    </div>
                                </div>
                            @endforeach
                </div>
                    @endforeach
                </div>

                @if(isset($t['child']))
                    <div class="weui-cells">
                        @foreach($t['child'] as $c)
                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <img class="floor-img" src="/images/admin/group-floorb.png">
                                </div>
                                <div class="weui-cell__bd">
                                    <p class="whole-name">{{$c['group_name']}}</p>
                                </div>
                            </div>
                            @foreach($c['member'] as $cm)
                                <div class="parent-div">
                                    <img class="sec-img" src="{{userlogo($cm->id)}}">
                                    <span class="sec-name">{{$cm['qw_name']}}</span>
                                    @foreach($cm['role'] as $mr)
                                        <span class="circle-span span-exam">{{$roleArray[$mr]}}</span>
                                    @endforeach

                                    @foreach($cm->achievement as $achievement)
                                        <div class="childern-div">
                                            <div>
                                                <p class="project-p">{{$achievement->name}}</p>
                                            </div>
                                            <div class="standard-p">
                                                <p class="gray-p">标准值</p>
                                                <p class="stand-p">{{$achievement->standard}}</p>
                                            </div>
                                            <div class="standard-p">
                                                <p class="gray-p">完成值</p>
                                                <p class="stand-p">{{$achievement->score}}</p>
                                            </div>
                                        </div>
                                    @endforeach
                            @endforeach
                                </div>
                    </div>
                    @foreach($c['child'] as $cc)
                        <div class="weui-cells">
                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <img class="floor-img" src="/images/admin/group-floorc.png">
                                </div>
                                <div class="weui-cell__bd">
                                    <p class="whole-name">{{$cc['group_name']}}</p>
                                </div>
                            </div>

                            @foreach($cc['member'] as $ccm)
                                <div class="parent-div">
                                    <img class="sec-img" src="{{userlogo($ccm->id)}}">
                                    <span class="sec-name">{{$ccm['qw_name']}}</span>
                                    @foreach($ccm['role'] as $mr)
                                      {{--  <span class="circle-span span-exam">{{$roleArray[$ccm]}}</span>--}}
                                    @endforeach

                                 @foreach($ccm->achievement as $achievement)
                                <div class="childern-div">
                                    <div>
                                        <p class="project-p">{{$achievement->name}}</p>
                                    </div>
                                    <div class="standard-p">
                                        <p class="gray-p">标准值</p>
                                        <p class="stand-p">{{$achievement->standard}}</p>
                                    </div>
                                    <div class="standard-p">
                                        <p class="gray-p">完成值</p>
                                        <p class="stand-p">{{$achievement->score}}</p>
                                    </div>
                                </div>
                                @endforeach
                                </div>
                            @endforeach
                        </div>
                    @endforeach
                    @endforeach
                @endif
            @endforeach
        </div>
        <!-- 隐藏考核按钮部分-->

        @if($user->getRole()==9)

            @include('sysadmin.admin-caidan')
        @else
            <div class="reful-tabbar">
                <a href="{{url('/user/performance/perf')}}" class="tabbar-item">
                    <p style="line-height: 65px;" class="tabbar-label">返回个人用户界面</p>
                </a>
            </div>

        @endif
    </div>
    <script src="/js/jquery-2.1.4.min.js"></script>
    <script src="/addons/jquery-weui-build/js/fastclick.js"></script>
    <script>
        $(function () {
            document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
            FastClick.attach(document.body);
        });
    </script>
    <script src="/addons/jquery-weui-build/js/jquery-weui.min.js"></script>
    <script src="/js/mobileSelect.js"></script>
    <script>
        $(document).ready(function () {

            $('.admin-item').click(function(){
                $('.front-show-hidden').toggle();
            });
            var UplinkData = [
                {
                    id: '2018',
                    value: '2018年',
                    childs: [
                        {id: '1', value: '1月'},
                        {id: '2', value: '2月'},
                        {id: '3', value: '3月'},
                        {id: '4', value: '4月'},
                        {id: '5', value: '5月'},
                        {id: '6', value: '6月'},
                        {id: '7', value: '7月'},
                        {id: '8', value: '8月'},
                        {id: '9', value: '9月'},
                        {id: '10', value: '10月'},
                        {id: '11', value: '11月'},
                        {id: '12', value: '12月'},
                        {id: '0', value: '全年'}
                    ]
                },
                {
                    id: '2019',
                    value: '2019年',
                    childs: [
                        {id: '1', value: '1月'},
                        {id: '2', value: '2月'},
                        {id: '3', value: '3月'},
                        {id: '4', value: '4月'},
                        {id: '5', value: '5月'},
                        {id: '6', value: '6月'},
                        {id: '7', value: '7月'},
                        {id: '8', value: '8月'},
                        {id: '9', value: '9月'},
                        {id: '10', value: '10月'},
                        {id: '11', value: '11月'},
                        {id: '12', value: '12月'},
                        {id: '0', value: '全年'}
                    ]
                },
                {
                    id: '2020',
                    value: '2020年',
                    childs: [
                        {id: '1', value: '1月'},
                        {id: '2', value: '2月'},
                        {id: '3', value: '3月'},
                        {id: '4', value: '4月'},
                        {id: '5', value: '5月'},
                        {id: '6', value: '6月'},
                        {id: '7', value: '7月'},
                        {id: '8', value: '8月'},
                        {id: '9', value: '9月'},
                        {id: '10', value: '10月'},
                        {id: '11', value: '11月'},
                        {id: '12', value: '12月'},
                        {id: '0', value: '全年'}
                    ]
                }
            ]
            var mobileSelect3 = new MobileSelect({
                trigger: '#trigger3',
                title: '选择时间',
                wheels: [
                    {data: UplinkData}
                ],
                //     keyMap: {
                //        id:'id',
                //        value: 'name',
                //        childs :'son'
                //      },
                position: [0, 1],
                callback: function (indexArr, data) {
                    //
                    var year = data[0].id;
                    var month = data[1].id;

                    window.location.href = '/admin/achievementcheck?year=' + year + '&month=' + month;
                    console.log(data[1].id); //返回选中的json数据
                }
            });
            $('.whole-name').click(function () {
                $(this).toggleClass('whole-up');
                $(this).parent().parent().siblings('.parent-div').toggle();
            })
            $('.parent-div').click(function () {
                $(this).find('.sec-name').toggleClass('sec-up');
                $(this).find('.childern-div').toggle();
            })
        })
    </script>




@endsection
